# This gray area is called an "R-chunk".
# These library commands install some powerful functions for your use later on.
library(mosaic)
library(pander)
library(tidyverse)
library(DT)
library(plotly)
# This read_csv command reads in the "Rent" data set into an object called "Rent"
Rent <- read_csv("../Data/Rent.csv")
# To load this data set into your R-Console do the following:
# 1. From your top file menu select "Session -> Set Working Directory -> To Source File Location"
# 2. Press the green "play button" in the top right corner of this gray box (which is called an "R-chunk").
# 3. Then in your "Console" window of
Here is a data table showing the available approved housing apartment options at BYU-Idaho for single students. There are 122 entries comprising 57 female and 65 male apartment options. Is it cheaper for a Private room or a Normal room, and is it more affordable than other universities? I believe that Normal rooms will be cheaper than the private rooms, but both will be cheaper than the rent at any other university.
# Code to get you started.
# View(...) works great in the Console, but datatable(...) must be
# used instead within an R-chunk.
datatable(Rent, options=list(lengthMenu = c(3,10,30)), extensions="Responsive")
The scatterplot below is a representation of the relationship between private room rent and normal rent for a single semester at Brigham Young University-Idaho.
# Use this R-chunk to...
# ...Create an interesting graphic using the Rent data set.
plot_ly(Rent, x= Rent$PrivateRoomPrice, y= Rent$Price, size= Rent$FloorPlans, text= paste("Apartment Name:", Rent$Apartment,"\n", "Phone Number:", Rent$Phone, "\n", "Website:", Rent$Website), color= Rent$Gender, colors=c("deeppink","darkslategray3")) %>% layout(title=("Private Room Rent vs. Normal Rent at BYU-I"), xaxis=list(title="Private Room Rent (in dollars)"), yaxis=list(title="Normal Rent (in dollars)" ))
From this scatterplot we can see a positive relationship between private room rent and normal rent. As private room rent increases so does the normal rent. We can also see from the graph that there are more apartments for women between 1400-1600 dollars in private room rent than there are for men. Another observation we can make is that there are more apartments for men between 800-1000 dollars in private room rent than women.
# Use this R-chunk to...
# ...compute and display a meaningful table of numerical summaries supporting your above graphic.
outputTable <- rbind('Private Room Rent'= summary(Rent$PrivateRoomPrice), 'Normal Rent' = summary(Rent$Price))
outputTable2 <- rbind('r' = cor(Rent$PrivateRoomPrice,Rent$Price,use= "complete.obs"))
pander(outputTable,caption = "Private Room Rent vs. Normal Rent at Brigham Young University-Idaho")
| Min. | 1st Qu. | Median | Mean | 3rd Qu. | Max. | NA’s | |
|---|---|---|---|---|---|---|---|
| Private Room Rent | 850 | 995 | 1150 | 1165 | 1310 | 1669 | 5 |
| Normal Rent | 850 | 981 | 1120 | 1133 | 1268 | 1585 | 5 |
pander(outputTable2)
| r | 0.9764 |
The data table above compares the quartiles of both private room rent and normal rent. From this data we can come to the conclusion that there is not a big difference between private room rent and normal rent in the first quartile, but as we get to quartile three, we can see that there is a significant difference between the two prices. Then the r shows the correlation between private room rent and normal rent. Since the r value is close to one, then we can come to the conclusion that there is a positive correlation between private room rent and normal rent.
According to debt.org, for a normal college student that decides to live in an apartment will have to pay $675 per month. One thing about Brigham Young University - Idaho is that it is a three semester college, meaning that there are three semesters in one school year. In a normal two semester college, there are about 6 months in a semester, so the cost of a college student to rent an apartment would be about $4,050 per semester. The mean for the price for a private room per semester at Brigham Young University-Idaho is $1,165. From this data, we can come to the conclusion that private room’s rent is going to be more than what the normal room’s rent is, and that Brigham Young University-Idaho is more affordable for housing per semester than what the average says about other colleges.